<template>
  <div class="app-container">
    <el-container>
      <el-aside width="200px">
        <!-- el-menu========整个菜单页面 -->
        <!-- el-sub-menu======一级菜单下面有子菜单，可实现标签嵌套 -->
        <!-- el-menu-item--------每个菜单项 -->
        <el-menu active-text-color="#ffd04b" background-color="#545c64" class="el-menu-vertical-demo" default-active="2"
          text-color="#fff" @open="handleOpen" @close="handleClose" :router="true">
          <!-- <el-sub-menu index="1">
            <template #title>
              <span>Navigator One</span>
            </template>
            <el-menu-item index="1-3">item three</el-menu-item>
            <el-sub-menu index="1-4">
              <template #title>item four</template>
              <el-menu-item index="1-4-1">item one</el-menu-item>
            </el-sub-menu>
          </el-sub-menu>
          <el-menu-item index="2" v-for="route in routes" @click="showRoute(route)">
            <el-icon><icon-menu /></el-icon>
            <span>Navigator Two</span>
          </el-menu-item> -->
          <childRoute :routes="routes" />
        </el-menu>
      </el-aside>
      <el-container>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts" setup>
import childRoute from './childRoute.vue'
import { ref } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter()
const defaultActive = ref('/');
const handleMenuSelect = (index: any) => {
  router.push(index);
  defaultActive.value = index;
};
const routes = [
  {
    "path": "/home/dashboard",
    "component": "dashboard1st/dashboard1st",
    "name": "dashboard1st",
    "meta": {
      "title": "首页",
      "icon": "fal fa-home",
      "hidden": false,
      "keepAlive": true
    },
    "code": "1",
    "children": [],
    "pcode": "0"
  },
  {
    "path": "/userManage/wxuserList",
    "component": "userManage/wxuserList",
    "name": "wxuserList",
    "meta": {
      "title": "微信用户管理",
      "icon": "fal fa-bring-forward",
      "hidden": false,
      "keepAlive": true
    },
    "code": "77443477218000896",
    "children": [],
    "pcode": "0"
  },
  {
    "path": "/unitManage",
    "component": "unitManage",
    "name": "unitManage",
    "meta": {
      "title": "组织结构管理",
      "icon": "fal fa-bring-forward",
      "hidden": false,
      "keepAlive": false
    },
    "code": "77698546156961792",
    "children": [
      {
        "path": "/unitManage/wxDeptList",
        "component": "unitManage/wxDeptList",
        "name": "wxDeptList",
        "meta": {
          "title": "部门列表",
          "icon": "fal fa-pencil-ruler",
          "hidden": false,
          "keepAlive": true
        },
        "code": "77700011957157888",
        "children": [],
        "pcode": "77698546156961792"
      },
      {
        "path": "/unitManage/wxNewDept",
        "component": "unitManage/wxNewDept",
        "name": "wxNewDept",
        "meta": {
          "title": "新增部门",
          "icon": "fal fa-pencil-ruler",
          "hidden": true,
          "keepAlive": false
        },
        "code": "78213923488137216",
        "children": [],
        "pcode": "77698546156961792"
      },
      {
        "path": "/unitManage/wxDeptupdate",
        "component": "unitManage/wxDeptupdate",
        "name": "wxDeptupdate",
        "meta": {
          "title": "同步部门",
          "icon": "fal fa-pencil-ruler",
          "hidden": false,
          "keepAlive": true
        },
        "code": "77700408276942848",
        "children": [],
        "pcode": "77698546156961792"
      }
    ],
    "pcode": "0"
  },
  {
    "path": "/sapManage",
    "component": "sapManage",
    "name": "sapManage",
    "meta": {
      "title": "SAP辅助系统",
      "icon": "fal fa-bring-forward",
      "hidden": false,
      "keepAlive": true
    },
    "code": "6",
    "children": [
      {
        "path": "/sapManage/sapList",
        "component": "sapManage/sapList",
        "name": "sapList",
        "meta": {
          "title": "SAP辅助报表",
          "icon": "fal fa-pencil-ruler",
          "hidden": false,
          "keepAlive": true
        },
        "code": "7",
        "children": [],
        "pcode": "6"
      }
    ],
    "pcode": "0"
  },
  {
    "path": "/psychological",
    "component": "psychological",
    "name": "psychological",
    "meta": {
      "title": "心里测评管理",
      "icon": "fal fa-bring-forward",
      "hidden": false,
      "keepAlive": false
    },
    "code": "103063598862958592",
    "children": [
      {
        "path": "/psychological/psychologicalTopic",
        "component": "psychological/psychologicalTopic",
        "name": "psychologicalTopic",
        "meta": {
          "title": "测评试题",
          "icon": "fal fa-pencil-ruler",
          "hidden": false,
          "keepAlive": true
        },
        "code": "103064108391202816",
        "children": [],
        "pcode": "103063598862958592"
      },
      {
        "path": "/psychological/psychologicalResult",
        "component": "psychological/psychologicalResult",
        "name": "psychologicalResult",
        "meta": {
          "title": "测评结果",
          "icon": "fal fa-pencil-ruler",
          "hidden": false,
          "keepAlive": true
        },
        "code": "103064422448103424",
        "children": [],
        "pcode": "103063598862958592"
      },
      {
        "path": "/psychological/psychologicalAnswer",
        "component": "psychological/psychologicalAnswer",
        "name": "psychologicalAnswer",
        "meta": {
          "title": "测评详情",
          "icon": "fal fa-pencil-ruler",
          "hidden": true,
          "keepAlive": false
        },
        "code": "103064742569967616",
        "children": [],
        "pcode": "103063598862958592"
      }
    ],
    "pcode": "0"
  }
]
const handleOpen = (key: string, keyPath: string[]) => {
  // console.log(key, keyPath, '111111111111111')
}
const handleClose = (key: string, keyPath: string[]) => {
  // console.log(key, keyPath, '3333333333333333333')
}

const showRoute = (route) => {
  console.log(route);
}
</script>

<script lang="ts">
export default {
  name: 'aaaa'
}
</script>

<style lang="scss" scoped></style>
